from threading import *
from Queue import *
from BeautifulSoup import *

class Configurator(Thread):
    cfile = "config/config.xml"
    config = None
    iQueue = Queue(0)
    ready = False
    
    def init(self, conf_file):
        self.cfile = conf_file
        
    def reload(self):
        self.ready = False
        conf = open(self.cfile)
        self.config = BeautifulStoneSoup(conf).config
        conf.close()
        self.ready = True
        
    def run (self):

        self.setName("config")
        self.reload()
        while True:
            xmsg = self.iQueue.get()
            if xmsg != None:
                msg = xmsgproc(xmsg)
                if msg.id.string == "reload_conf":
                    self.reload()
                elif msg.id.string == "die":
                    break


        
        